import api from "@/config/api";
import LoginDto from "@/dto/LoginDto";
import http from "@/utils/http";
import UserInfo from "@/vo/UserInfo";
import store from "@/store/index";
import router from "@/config/router";

/**
 * 权限认证模块
 */
export const authService = {
    /**
     * 用户登录
     * @param loginDto 用户登录实体
     */
    login(loginDto: LoginDto) {
        http.post(api.login, loginDto, (userInfo: UserInfo) => {
            store.commit("baseInfo/setUserInfo", userInfo);
            console.log(userInfo);
            router.replace({path: '/home'})
        })
    }
};